package com.xiaoyang.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author lichenyang
 * @create 2021-07-11 19:53
 *
 * 一定要将 car 放到容器中, 只有在容器中的组件 才能使用springboot的功能
 * prefix: 前缀, application.yml 中的前缀要和 prefix 中的前缀相同
 */
//@Component
@ConfigurationProperties(prefix = "car")
public class Car {

    private String color;

    private Integer price;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Car{" +
                "color='" + color + '\'' +
                ", price=" + price +
                '}';
    }
}
